package com.design.pattern.strategy.spring;

import lombok.Builder;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * @author goujian
 *
 * @description: 登录上下文
 * @date 2022/3/14 10:10 上午
 */
@Data
@Builder
public class LoginContext {
    private LoginStrategy<LoginReqDto> loginStrategy;
    public void loginHandle(LoginReqDto loginReqDto) {
        Optional.ofNullable(loginStrategy).ifPresent(e -> e.login(loginReqDto));
    }
}
